window.onload = function () {
  var arr = document.querySelectorAll(".section");
  function anim() {
    var top = document.documentElement.scrollTop || document.body.scrollTop;
    var l = arr.length;
    var h = window.innerHeight;
    for (var i = 1; i < l; i++) {
      if (top > h * (i - 0.5)) {
        arr[i].className = "section shown";
      } else {
        arr[i].className = "section";
      }
    }
  }
  window.onscroll = function () {
    anim();
  };
  anim();
};
